package com.ruoyi.workSafetyStandardization.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.workSafetyStandardization.dto.inspection.MajorDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.workSafetyStandardization.mapper.InspectionTeamMembersMapper;
import com.ruoyi.workSafetyStandardization.domain.InspectionTeamMembers;
import com.ruoyi.workSafetyStandardization.service.IInspectionTeamMembersService;

/**
 * 考核评委组人员Service业务层处理
 *
 * @author pengjie
 * @date 2023-12-18
 */
@Service
public class InspectionTeamMembersServiceImpl implements IInspectionTeamMembersService
{
    @Autowired
    private InspectionTeamMembersMapper inspectionTeamMembersMapper;

    /**
     * 查询考核评委组人员
     *
     * @param inspectionMemberId 考核评委组人员主键
     * @return 考核评委组人员
     */
    @Override
    public InspectionTeamMembers selectInspectionTeamMembersByInspectionMemberId(String inspectionMemberId)
    {
        return inspectionTeamMembersMapper.selectInspectionTeamMembersByInspectionMemberId(inspectionMemberId);
    }

    /**
     * 查询考核评委组人员列表
     *
     * @param inspectionTeamMembers 考核评委组人员
     * @return 考核评委组人员
     */
    @Override
    public List<InspectionTeamMembers> selectInspectionTeamMembersList(InspectionTeamMembers inspectionTeamMembers)
    {
        return inspectionTeamMembersMapper.selectInspectionTeamMembersList(inspectionTeamMembers);
    }

    /**
     * 新增考核评委组人员
     *
     * @param inspectionTeamMembers 考核评委组人员
     * @return 结果
     */
    @Override
    public int insertInspectionTeamMembers(InspectionTeamMembers inspectionTeamMembers)
    {
        inspectionTeamMembers.setCreateByName(SecurityUtils.getUsername());
        inspectionTeamMembers.setCreateAt(new Date());
        inspectionTeamMembers.setCreateBy(SecurityUtils.getUserId().toString());
        return inspectionTeamMembersMapper.insertInspectionTeamMembers(inspectionTeamMembers);
    }

    /**
     * 修改考核评委组人员
     *
     * @param inspectionTeamMembers 考核评委组人员
     * @return 结果
     */
    @Override
    public int updateInspectionTeamMembers(InspectionTeamMembers inspectionTeamMembers)
    {
        return inspectionTeamMembersMapper.updateInspectionTeamMembers(inspectionTeamMembers);
    }

    /**
     * 批量删除考核评委组人员
     *
     * @param inspectionMemberIds 需要删除的考核评委组人员主键
     * @return 结果
     */
    @Override
    public int deleteInspectionTeamMembersByInspectionMemberIds(String[] inspectionMemberIds)
    {
        return inspectionTeamMembersMapper.deleteInspectionTeamMembersByInspectionMemberIds(inspectionMemberIds);
    }

    /**
     * 删除考核评委组人员信息
     *
     * @param inspectionMemberId 考核评委组人员主键
     * @return 结果
     */
    @Override
    public int deleteInspectionTeamMembersByInspectionMemberId(String inspectionMemberId)
    {
        return inspectionTeamMembersMapper.deleteInspectionTeamMembersByInspectionMemberId(inspectionMemberId);
    }

    /**
     * 通过inspectionId查找评委组人员信息
     *
     * @param inspectionId 考核汇总主键
     * @return 结果
     */
    @Override
    public List<InspectionTeamMembers> queryLeaderListByInspectionId(String inspectionId) {
        return inspectionTeamMembersMapper.queryLeaderListByInspectionId( inspectionId) ;
    }

    @Override
    public List<InspectionTeamMembers> queryLeaderListByInspectionIdAndMajorId(MajorDto it) {
        return inspectionTeamMembersMapper.queryLeaderListByInspectionIdAndMajorId(it) ;
    }
}
